<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <!-- 使用wimdow.addEventListener('load', function() {}可以使<script></script>在任何位置 -->
    <script>
        window.addEventListener('load', function() {
         var btn = document.querySelector('button');
         btn.addEventListener('click', function() {
             alert('点击我');
         });
        });
        window.addEventListener('load', function() {
        alert(111);
        });
        window.addEventListener('DOMContentLoaded', function() {
            alert(222);
        });
     </script>
    <button>点击</button>
    
</body>
</html>